//
//  YsNoteSDKHeader.h
//  YsNoteSDK
//
//  Created by 宋宏康 on 2020/3/21.
//

#ifndef YsNoteSDKHeader_h
#define YsNoteSDKHeader_h

#import "YsNoteSDKUserInforModel.h"

#define YsNoteSDKUploadServerLink(A) YsNoteSDKUserInforModel.shareManager.uploadServiceHost ? : @"https://service.ys100.com/"#A

#define kaccountCode YsNoteSDKUserInforModel.shareManager.accountCode

/// 获取管理平台的URL
/// 管理平台服务器
#define YsNoteSDKUserDefaults [NSUserDefaults standardUserDefaults]
#define YsNoteSDKUserDefaultsObjectForKey(x) [YsNoteSDKUserDefaults objectForKey:x]
#define YsNoteSDKUserDefaultsRemoveObjectForKey(x) [YsNoteSDKUserDefaults removeObjectForKey:x]
#define YsNoteSDKUserDefaultsSetObjectForKey(x,y) [YsNoteSDKUserDefaults setObject:y forKey:x]

#define KYsNoteSDKManageTestUrl  @"https://testschoolcloudapi.ys100.com/"    //测试
#define KYsNoteSDKManageDevUrl  @"https://devschoolcloudapi.ys100.com/"      //演示
#define KYsNoteSDKManagePortalUrl  @"https://schoolcloudapi.ys100.com/"      //正式
#define kYsNoteSDKIsTest [YsNoteSDKUserDefaultsObjectForKey(@"CE") isEqualToString:@"1"]
#define kYsNoteSDKIsDev [YsNoteSDKUserDefaultsObjectForKey(@"CE") isEqualToString:@"2"]

#define KYsNoteSDKUrl kYsNoteSDKIsTest ? KYsNoteSDKManageTestUrl : kYsNoteSDKIsDev ? KYsNoteSDKManageDevUrl : KYsNoteSDKManagePortalUrl

#define YsNoteSDKUrlLink(A) KYsNoteSDKUrl#A


#define  YsNoteSDKCloudSpaceDownloadZip @"https://service.ys100.com/down_api/down/storage/down?uuid="
#define YsNoteSDKCloudSpaceDownloadZipUrlLink(A) YsNoteSDKCloudSpaceDownloadZip#A



#define SemaphoreBegin \
static dispatch_semaphore_t semaphore; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
    semaphore = dispatch_semaphore_create(1); \
}); \
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

#define SemaphoreEnd \
dispatch_semaphore_signal(semaphore);


#endif /* YsNoteSDKHeader_h */
